26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
50 #pragma package(smart_init)
63 Graphics::TBitmap* SmallGraphicPtrVal) : SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
65 for(
int x = 0; x < 4; x++)
76 else if(SpeedTagVal == 77)
80 else if(SpeedTagVal == 78)
84 else if(SpeedTagVal == 79)
88 else if(SpeedTagVal == 96)
92 else if(SpeedTagVal == 129)
96 else if(SpeedTagVal == 130)
100 else if(SpeedTagVal == 131)
104 else if(SpeedTagVal == 145)
108 else if(SpeedTagVal == 146)
117 FixedNamedLocationElement(false)
119 for(
int x = 0; x < 4; x++)
130 AnsiString(VLocInput));
143 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
157 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
173 Graphics::TBitmap *GraphicOutput = GraphicPtr;
175 if(LocationName ==
"")
220 GraphicOutput = GraphicPtr;
224 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
233 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
234 AnsiString(TrainIDOnBridgeTrackPos01) +
"," + AnsiString(TrainIDOnBridgeTrackPos23) +
",EndTrkEl,";
243 Attribute(0), CallingOnSet(false), Length01(
Track->DefaultTrackLength), Length23(-1), SpeedLimit01(
Track->DefaultTrackSpeedLimit), SpeedLimit23(-1),
244 TrainIDOnElement(-1), TrainIDOnBridgeTrackPos01(-1), TrainIDOnBridgeTrackPos23(-1), StationEntryStopLinkPos1(-1), StationEntryStopLinkPos2(-1),
245 SigAspect(FourAspect)
247 for(
int x = 0; x < 4; x++)
263 if(lower.second < higher.second)
267 else if(lower.second > higher.second)
271 else if(lower.second == higher.second)
273 if(lower.first < higher.first)
286 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
287 CheckCount(9), IsARoute(false), AutoSignals(false), PrefDirRoute(false)
291 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
302 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
330 {2, 4}, {6, 2}, {8, 6}, {4, 8},
331 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
341 else if(
Link[2] == -1)
354 else if(
Link[2] == -1)
363 for(
int x = 0; x < 16; x++)
365 if(((Entry == EXArray[x][0]) && (Exit == EXArray[x][1])) || ((Entry == EXArray[x][1]) && (Exit == EXArray[x][0])))
541 throw Exception(
"Error in EntryExitNumber 4");
636 throw Exception(
"Error in EntryExitNumber 5");
733 throw Exception(
"Error in EntryExitNumber 6");
823 throw Exception(
"Error in EntryExitNumber 10");
913 throw Exception(
"Error in EntryExitNumber 11");
1009 throw Exception(
"Error in EntryExitNumber 7");
1040 throw Exception(
"Error in EntryExitNumber 8");
1051 if((ELink > 0) && (ELink < 10) && (ELink != 5))
1053 if(!AutoSigsFlag && !PrefDirRoute)
1057 else if(!AutoSigsFlag && PrefDirRoute)
1068 throw Exception(
"Error in EntryExitNumber 9");
1112 TTrack::TActiveLevelCrossing::TActiveLevelCrossing()
1136 AnsiString NL =
'\n';
1138 RouteFailMessage =
"Unable to set a route:" + NL + NL +
"it may be unreachable; " + NL + NL +
1139 "reachable but with too many different directions leading away from the start point - set some points on the route required; " + NL + NL +
1140 "blocked by a train, another route or a changing level crossing; " + NL + NL +
1141 "or invalid - possibly due to a preferred direction mismatch, or a missed signal in a blue route or green route restricted to consecutive signals.";
1148 int InternalLinkCheckArray[9][2] =
1149 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
1154 for(
int x = 0; x < 9; x++)
1156 for(
int y = 0; y < 2; y++)
1163 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
1165 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
1166 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
1167 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
1168 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 20 << 21 << 22 << 23 << 24 << 25 << 26 << 27
1169 << 60 << 61 << 62 << 63 << 68 << 69 << 70 << 71 << 80 << 81 << 82 << 83 << 125 << 126 << 127 << 128;
1175 int HVArray[10][2] =
1176 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
1178 for(
int x = 0; x < 10; x++)
1180 for(
int y = 0; y < 2; y++)
1189 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1192 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1193 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1195 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
1196 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
1198 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1199 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1202 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1205 for(
int x = 0; x < 40; x++)
1211 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1214 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1215 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1217 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1218 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1220 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1221 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1224 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1227 for(
int x = 0; x < 40; x++)
1233 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1236 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
1237 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1239 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1240 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1242 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1243 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1246 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1249 for(
int x = 0; x < 40; x++)
1275 for(
int x = 0; x < 40; x++)
1302 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1303 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1304 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1305 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1306 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1307 {0, 0, 129}, {0, -1, 145},
1310 for(
int x = 0; x < 25; x++)
1312 for(
int y = 0; y < 3; y++)
1320 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1321 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1322 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1323 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1324 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1325 {0, 0, 129}, {0, 1, 145},
1328 for(
int x = 0; x < 25; x++)
1330 for(
int y = 0; y < 3; y++)
1338 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1339 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1340 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1341 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1342 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1343 {0, 0, 130}, {-1, 0, 146},
1346 for(
int x = 0; x < 25; x++)
1348 for(
int y = 0; y < 3; y++)
1356 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1357 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1358 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1359 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1360 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1361 {0, 0, 130}, {1, 0, 146},
1364 for(
int x = 0; x < 25; x++)
1366 for(
int y = 0; y < 3; y++)
1374 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1375 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1376 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1377 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1378 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1379 {0, -1, 129}, {1, 0, 130},
1380 {-1, 0, 130}, {0, 1, 145},
1381 {0, -1, 145}, {1, 0, 146},
1384 for(
int x = 0; x < 28; x++)
1386 for(
int y = 0; y < 3; y++)
1404 for(
int x = 0; x < 8; x++)
1406 for(
int y = 0; y < 3; y++)
1424 for(
int x = 0; x < 8; x++)
1426 for(
int y = 0; y < 3; y++)
1444 for(
int x = 0; x < 8; x++)
1446 for(
int y = 0; y < 3; y++)
1464 for(
int x = 0; x < 8; x++)
1466 for(
int y = 0; y < 3; y++)
1474 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1476 for(
int x = 0; x < 4; x++)
1478 for(
int y = 0; y < 3; y++)
1486 0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1487 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1488 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1489 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1495 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1496 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1497 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1498 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1504 0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1505 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1506 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1507 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1513 0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1514 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1515 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1516 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1538 delete UGMIt->second;
1614 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1615 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1617 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1624 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1625 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1638 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1639 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1641 {4, 6, 2, 8}, {1, 9, 3, 7},
1643 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1645 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8}, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1648 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1649 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6}, {3, 7, 4, 6},
1650 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1651 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1},
1652 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1653 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1654 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1656 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1657 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1658 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1659 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1660 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1661 {4, 6, -1, -1}, {2, 8, -1, -1},
1663 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1665 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1667 {4, 6, -1, -1}, {2, 8, -1, -1},
1672 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1673 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1674 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1675 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1678 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1679 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1680 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1682 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1683 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1684 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1686 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1688 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1689 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1690 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1691 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1692 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1693 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1694 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1695 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1696 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1697 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1698 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1699 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1700 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1702 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1703 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1704 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1705 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1706 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1707 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1708 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1709 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1713 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1714 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1715 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1721 for(
int x = 0; x < 17; x++)
1723 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1725 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1729 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1735 ExistingGraphicLoaded(false), Width(16), Height(16)
1747 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1785 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1789 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1793 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1797 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1820 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1823 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1827 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1831 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1865 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1886 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1900 bool TrackPresent =
false;
1914 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1918 TrackPresent =
true;
1923 return(!TrackPresent);
1931 bool TrackPresent =
false;
1940 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1944 TrackPresent =
true;
1950 return(!TrackPresent);
1955 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
1958 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1959 TrackEraseSuccessfulFlag =
false;
1964 ErasedTrackVectorPosition = -1;
1965 AnsiString SName =
"", ErrorString;
1967 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
1973 TrackMapKeyPair.first = HLocInput;
1974 TrackMapKeyPair.second = VLocInput;
1975 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
1986 if(ErrorString !=
"")
1988 throw Exception(ErrorString +
" for EraseTrackElement 1");
2012 ErasedTrackVectorPosition = VecPos;
2013 TrackEraseSuccessfulFlag =
true;
2019 unsigned int VecPos;
2020 InactiveTrackMapKeyPair.first = HLocInput;
2021 InactiveTrackMapKeyPair.second = VLocInput;
2026 VecPos = InactiveTrack2MultiMapIterator->second;
2031 if(ErrorString !=
"")
2033 throw Exception(ErrorString +
" for EraseTrackElement 2A");
2043 TrackEraseSuccessfulFlag =
true;
2064 VecPos = InactiveTrack2MultiMapIterator->second;
2069 if(ErrorString !=
"")
2071 throw Exception(ErrorString +
" for EraseTrackElement 2B");
2095 if(TrackEraseSuccessfulFlag)
2117 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2118 bool PlatAllowedFlag =
false;
2120 TrackLinkingRequiredFlag =
false;
2132 LocationNameEntry.first =
"";
2140 TempTrackElement.
HLoc = HLocInput;
2141 TempTrackElement.
VLoc = VLocInput;
2167 else if(Aspect == 1)
2171 else if(Aspect == 2)
2175 else if(Aspect == 3)
2184 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2187 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2189 if(InactiveFoundFlag)
2193 NonStationOrLevelCrossingPresent =
true;
2197 NonStationOrLevelCrossingPresent =
true;
2201 PlatformPresent =
true;
2212 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2220 PlatAllowedFlag =
true;
2224 PlatAllowedFlag =
true;
2228 PlatAllowedFlag =
true;
2232 PlatAllowedFlag =
true;
2236 TrackLinkingRequiredFlag =
true;
2264 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1048, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2265 (!FoundFlag && !InactiveFoundFlag))
2268 TrackLinkingRequiredFlag =
true;
2300 TrackLinkingRequiredFlag =
true;
2312 else if(FoundFlag || InactiveFoundFlag)
2331 bool BothPointFillets =
true;
2346 TrackLinkingRequiredFlag =
true;
2360 bool InternalChecks)
2364 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2365 bool PlatAllowedFlag =
false;
2367 TrackLinkingRequiredFlag =
false;
2370 LocationNameEntry.first =
"";
2376 TempTrackElement.
HLoc = HLocInput;
2377 TempTrackElement.
VLoc = VLocInput;
2378 for(
int x = 0; x < 4; x++)
2384 TempTrackElement.
Conn[x] = -1;
2388 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2399 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2401 if(InactiveFoundFlag)
2405 NonStationOrLevelCrossingPresent =
true;
2409 NonStationOrLevelCrossingPresent =
true;
2413 PlatformPresent =
true;
2424 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2432 PlatAllowedFlag =
true;
2436 PlatAllowedFlag =
true;
2440 PlatAllowedFlag =
true;
2444 PlatAllowedFlag =
true;
2448 TrackLinkingRequiredFlag =
true;
2479 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1055, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2480 (!FoundFlag && !InactiveFoundFlag))
2483 TrackLinkingRequiredFlag =
true;
2518 TrackLinkingRequiredFlag =
true;
2530 else if(FoundFlag || InactiveFoundFlag)
2549 bool BothPointFillets =
true;
2564 TrackLinkingRequiredFlag =
true;
2594 ShowMessage(
"Gaps must be set before track can be validated");
2604 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2615 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2632 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2639 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2663 std::pair<AnsiString, char>TempMapPair;
2671 TempMapPair.second =
'x';
2681 AnsiString Name =
"";
2682 typedef std::list<AnsiString> TNoPlatsList;
2683 TNoPlatsList::iterator NPLIt;
2684 TNoPlatsList NoPlatsList;
2685 typedef std::list<AnsiString> TLocNameList;
2686 TLocNameList LocNameList;
2691 LocNameList.push_back(LNMMIt->first);
2694 LocNameList.unique();
2695 for(TLocNameList::iterator LNLIt = LocNameList.begin(); LNLIt != LocNameList.end(); LNLIt++)
2699 if(MMRange.first == MMRange.second)
2705 if((LNMMIt->second) < 0)
2719 TempIt = MMRange.second;
2720 if(LNMMIt == --TempIt)
2722 NoPlatsList.push_back(Name);
2726 if(!NoPlatsList.empty())
2728 AnsiString NoPlatsAnsiList =
"";
2729 for(NPLIt = NoPlatsList.begin(); NPLIt != NoPlatsList.end(); NPLIt++)
2731 NoPlatsAnsiList += *NPLIt +
'\n';
2735 if(NoPlatsList.size() > 1)
2737 ShowMessage(
"Please note: the following locations have no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2741 ShowMessage(
"Please note: the following location has no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2756 int NewHLoc, NewVLoc;
2757 bool ConnectionFoundFlag, LinkFoundFlag;
2759 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2761 for(
unsigned int y = 0; y < 4; y++)
2779 ConnectionFoundFlag =
false;
2780 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2786 ConnectionFoundFlag =
true;
2788 LinkFoundFlag =
false;
2789 for(
unsigned int a = 0; a < 4; a++)
2793 LinkFoundFlag =
true;
2809 if(!ConnectionFoundFlag)
2884 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2901 bool UnsetGaps =
false;
2908 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2912 for(
unsigned int y = 0; y < 4; y++)
2924 for(
unsigned int y = 0; y < 4; y++)
2934 for(
unsigned int y = 1; y < 4; y++)
2943 for(
unsigned int y = 0; y < 4; y++)
2956 for(
unsigned int y = 0; y < 4; y++)
2984 int NumberOfActiveElements = 0;
2986 GraphicsFollow =
false;
2990 if(MarkerString[MarkerString.Length()] ==
'1')
2992 GraphicsFollow =
true;
2994 for(
int x = 0; x < NumberOfActiveElements; x++)
3000 TrackElement.
HLoc = TempInt;
3002 TrackElement.
VLoc = TempInt;
3008 TrackElement.
Conn[0] = TempInt;
3032 if((TempInt != -1) && (TempInt < 10))
3042 if((TempInt != -1) && (TempInt < 10))
3059 if(Marker[1] ==
'3')
3063 else if(Marker[1] ==
'2')
3067 else if(Marker[1] ==
'G')
3081 int NumberOfInactiveElements = 0;
3085 for(
int x = 0; x < NumberOfInactiveElements; x++)
3091 TrackElement.
HLoc = TempInt;
3093 TrackElement.
VLoc = TempInt;
3099 bool LocError =
false;
3128 for(
int x = 0; x < NumberOfGraphics; x++)
3139 bool FileError =
false;
3141 for(
int x = 0; x < NumberOfGraphics; x++)
3154 UGME.second =
new TPicture;
3155 UGME.second->LoadFromFile(
UGME.first);
3158 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
3165 catch(
const EInvalidGraphic &e)
3174 delete UGMIt->second;
3179 catch(
const Exception &e)
3188 delete UGMIt->second;
3196 bool FoundInMap =
false;
3215 UGME.second =
new TPicture;
3216 UGME.second->LoadFromFile(
UGME.first);
3219 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
3226 catch(
const EInvalidGraphic &e)
3235 delete UGMIt->second;
3240 catch(
const Exception &e)
3249 delete UGMIt->second;
3274 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
3278 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
3280 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
3283 VecFile << x <<
'\n';
3284 VecFile << TrackElement.
SpeedTag <<
'\n';
3285 VecFile << TrackElement.
HLoc <<
'\n';
3286 VecFile << TrackElement.
VLoc <<
'\n';
3290 VecFile << TrackElement.
Conn[0] <<
'\n';
3294 VecFile << TrackElement.
Attribute <<
'\n';
3300 VecFile << int(1) <<
'\n';
3304 VecFile << int(0) <<
'\n';
3307 VecFile << TrackElement.
Length01 <<
'\n';
3308 VecFile << TrackElement.
Length23 <<
'\n';
3311 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3318 VecFile <<
"3*****" <<
'\0' <<
'\n';
3322 VecFile <<
"2*****" <<
'\0' <<
'\n';
3326 VecFile <<
"G*****" <<
'\0' <<
'\n';
3330 VecFile <<
"4*****" <<
'\0' <<
'\n';
3335 VecFile <<
"******" <<
'\0' <<
'\n';
3340 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
3344 VecFile << x <<
'\n';
3345 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
3346 VecFile << InactiveTrackElement.
HLoc <<
'\n';
3347 VecFile << InactiveTrackElement.
VLoc <<
'\n';
3348 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3349 VecFile <<
"******" <<
'\0' <<
'\n';
3364 GraphicsFollow =
false;
3366 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
3372 AnsiString MarkerString;
3379 if(MarkerString[MarkerString.Length()] ==
'1')
3381 GraphicsFollow =
true;
3383 for(
int x = 0; x < NumberOfActiveElements; x++)
3391 int SpeedTag = TempInt;
3398 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3404 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3409 if((SpeedTag > 87) && (SpeedTag < 96))
3412 if((TempInt < -1) || (TempInt > 3))
3418 if((TempInt < -1) || (TempInt > 999999))
3424 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3425 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3428 if((TempInt < -1) || (TempInt > 5))
3434 if((SpeedTag >= 68) && (SpeedTag <= 75))
3437 if((TempInt != 0) && (TempInt != 1))
3444 if((TempInt < -1) || (TempInt > 999999))
3450 if((TempInt < -1) || (TempInt > 999999))
3456 if((TempInt < -1) || (TempInt > 999999))
3462 if((TempInt < -1) || (TempInt > 999999))
3483 int NumberOfInactiveElements = 0;
3486 if(NumberOfInactiveElements < 0)
3496 for(
int x = 0; x < NumberOfInactiveElements; x++)
3510 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3516 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3543 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3549 AnsiString FileName =
"", TempStr =
"";
3551 for(
int x = 0; x < NumberOfGraphics; x++)
3553 TPicture *TempPicture =
new TPicture;
3562 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3575 catch(
const EInvalidGraphic &e)
3580 for(
int y = x + 1; y < NumberOfGraphics; y++)
3586 ShowMessage(FileName +
3587 " has an incorrect file format, user graphics can't be loaded. Ensure that all user graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3592 catch(
const Exception &e)
3597 for(
int y = x + 1; y < NumberOfGraphics; y++)
3603 ShowMessage(
"Unable to load user graphic files, ensure that " + FileName +
3604 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3622 for(
int x = 0; x < VecSize; x++)
3645 for(
int x = 0; x < VecSize; x++)
3667 for(
int x = 0; x < VecSize; x++)
3721 for(
int x = 0; x < VecSize; x++)
3779 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3801 if(BothPointFilletsAndBasicLCs)
3876 Bitmap->Canvas->CopyMode = cmSrcCopy;
3878 Graphics::TBitmap *GraphicOutput;
4053 for(
int x = 0; x < 40; x++)
4082 Graphics::TBitmap *GraphicPtr;
4097 Graphics::TBitmap* SignalPlatformGraphic;
4130 if(OldTransparentColour !=
clB5G5R5)
4153 Bitmap->Canvas->CopyMode = cmSrcCopy;
4181 Bitmap->Canvas->CopyMode = cmSrcCopy;
4183 Graphics::TBitmap *GraphicOutput;
4193 if(BaseElement == 1)
4283 for(
int x = 0; x < 40; x++)
4312 Graphics::TBitmap *GraphicPtr;
4327 Graphics::TBitmap* SignalPlatformGraphic;
4388 for(
int x = 0; x < 40; x++)
4396 Graphics::TBitmap* SignalPlatformGraphic;
4417 if(OldTransparentColour !=
clB5G5R5)
4431 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4503 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4517 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4543 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4568 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4598 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4632 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4669 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4684 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4713 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4720 throw Exception(
"Error - Map & Vector different sizes");
4722 unsigned int NonZeroCount = 0;
4724 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4733 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4739 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4743 TrackMapEntry.first = TrackMapKeyPair;
4744 TrackMapEntry.second = x;
4745 if(!(
TrackMap.insert(TrackMapEntry).second))
4747 throw Exception(
"Error - map insertion failure, TrackVector in error");
4751 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4753 for(
unsigned int y = 0; y < 4; y++)
4778 THVPair GapMapKeyPair, GapMapValuePair;
4781 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4787 GapMapEntry.first = GapMapKeyPair;
4790 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4794 GapMapEntry.second = GapMapValuePair;
4797 GapMap.insert(GapMapEntry);
4812 bool TrackElementPositionsOK =
true;
4814 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4826 "Footbridge or underpass connection error. Each end must connect to a platform, concourse "
4827 "or other footbridge or underpass, and they can't connect to each other (i.e. a footbridge "
4828 "can't connect to an underpass or vice versa)");
4836 for(
unsigned int y = 0; y < 4; y++)
4854 bool ConnectionFoundFlag;
4858 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
4864 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4873 if(ConnectionFoundFlag)
4880 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
4882 TrackElementPositionsOK =
false;
4887 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
4889 TrackElementPositionsOK =
false;
4894 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
4898 TrackElementPositionsOK =
false;
4903 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
4906 TrackElementPositionsOK =
false;
4910 ShowMessage(
"Signal facing a bridge - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message will not be shown again.");
4913 TrackElementPositionsOK =
false;
4918 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
4919 TrackElementPositionsOK =
false;
4922 if(!TrackElementPositionsOK)
4929 throw Exception(
"Error in track element positions in FinalCall");
4942 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4948 for(
unsigned int y = 0; y < 4; y++)
4970 bool ConnectionFoundFlag;
4971 bool LinkMatchFound =
false;
4974 if(ConnectionFoundFlag)
4976 for(
unsigned int a = 0; a < 4; a++)
4985 LinkMatchFound =
true;
4996 throw Exception(
"Error in final track linkage - - no matching link found");
5009 throw Exception(
"Error in final track linkage - connection not found");
5024 bool ConnErrorFlag =
false;
5026 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5030 ConnErrorFlag =
true;
5034 ConnErrorFlag =
true;
5038 ConnErrorFlag =
true;
5042 ConnErrorFlag =
true;
5050 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5059 throw Exception(
"ConnError in LinkTrack - Final");
5063 throw Exception(
"ConnError in LinkTrack - Precheck");
5066 bool CLkErrorFlag =
false;
5068 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5072 CLkErrorFlag =
true;
5076 CLkErrorFlag =
true;
5080 CLkErrorFlag =
true;
5084 CLkErrorFlag =
true;
5092 throw Exception(
"CLkError in LinkTrack - Final");
5096 throw Exception(
"CLkError in LinkTrack - Precheck");
5101 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5131 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5147 for(
unsigned int y = 0; y < 4; y++)
5166 bool ConnectionFoundFlag;
5172 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5181 if(ConnectionFoundFlag)
5184 bool LinkFoundFlag =
false;
5241 for(
unsigned int a = 0; a < 4; a++)
5250 LinkFoundFlag =
true;
5258 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
5268 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
5281 bool ConnErrorFlag =
false;
5283 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5287 ConnErrorFlag =
true;
5291 ConnErrorFlag =
true;
5295 ConnErrorFlag =
true;
5299 ConnErrorFlag =
true;
5307 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5316 throw Exception(
"ConnError in LinkTrack - Final");
5320 throw Exception(
"ConnError in LinkTrack - Precheck");
5323 bool CLkErrorFlag =
false;
5325 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5329 CLkErrorFlag =
true;
5333 CLkErrorFlag =
true;
5337 CLkErrorFlag =
true;
5341 CLkErrorFlag =
true;
5349 throw Exception(
"CLkError in LinkTrack - Final");
5353 throw Exception(
"CLkError in LinkTrack - Precheck");
5357 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5386 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5402 for(
unsigned int y = 0; y < 4; y++)
5421 bool ConnectionFoundFlag =
false;
5423 if(ConnectionFoundFlag)
5427 bool LinkFoundFlag =
false;
5447 for(
unsigned int a = 0; a < 4; a++)
5456 LinkFoundFlag =
true;
5476 bool ConnErrorFlag =
false;
5478 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5482 ConnErrorFlag =
true;
5486 ConnErrorFlag =
true;
5490 ConnErrorFlag =
true;
5494 ConnErrorFlag =
true;
5502 bool CLkErrorFlag =
false;
5504 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5508 CLkErrorFlag =
true;
5512 CLkErrorFlag =
true;
5516 CLkErrorFlag =
true;
5520 CLkErrorFlag =
true;
5538 int Position1, Position2;
5544 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
5546 int HLoc1 = GapMapPtr->first.first;
5547 int VLoc1 = GapMapPtr->first.second;
5548 int HLoc2 = GapMapPtr->second.first;
5549 int VLoc2 = GapMapPtr->second.second;
5552 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
5556 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
5560 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
5564 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
5582 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
5583 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
5593 bool FoundFlag =
false;
5605 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
5606 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5607 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5636 bool FoundFlag =
false;
5649 TrackMapKeyPair.first = TrackElement.
HLoc;
5650 TrackMapKeyPair.second = TrackElement.
VLoc;
5651 TrackMapEntry.first = TrackMapKeyPair;
5656 LocationNameEntry.second = -(int)(
TrackVector.size());
5696 TrackMapKeyPair.first = HLoc;
5697 TrackMapKeyPair.second = VLoc;
5698 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5708 return(TrackMapPtr->second);
5721 TrackMapKeyPair.first = HLoc;
5722 TrackMapKeyPair.second = VLoc;
5723 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5726 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5727 throw Exception(Message);
5745 MapKeyPair.first = HLoc;
5746 MapKeyPair.second = VLoc;
5747 MapPtr = Map.find(MapKeyPair);
5748 if(MapPtr == Map.end())
5750 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc) +
" in GetTrackElementFromAnyTrackMap";
5751 throw Exception(Message);
5756 return(Vector.at(MapPtr->second));
5766 THVPair InactiveTrackMapKeyPair;
5769 InactiveTrackMapKeyPair.first = HLoc;
5770 InactiveTrackMapKeyPair.second = VLoc;
5774 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5775 throw Exception(Message);
5789 bool Present =
true;
5793 TrackMapKeyPair.first = HLoc;
5794 TrackMapKeyPair.second = VLoc;
5795 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5810 bool Present =
true;
5811 THVPair InactiveTrackMapKeyPair;
5814 InactiveTrackMapKeyPair.first = HLoc;
5815 InactiveTrackMapKeyPair.second = VLoc;
5833 THVPair InactiveTrackMapKeyPair;
5838 InactiveTrackMapKeyPair.first = HLoc;
5839 InactiveTrackMapKeyPair.second = VLoc;
5848 if(InactiveTrackRange.first == InactiveTrackRange.second)
5857 RetPair.first = InactiveTrackRange.first->second;
5858 RetPair.second = (--InactiveTrackRange.second)->second;
5871 AnsiString(DivergingPosition));
5882 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
5883 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
5884 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
5885 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
5886 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
5887 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
5888 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
5889 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
5890 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
5891 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
5892 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
5893 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
5927 throw Exception(
"Error, Wrong track type in PlotGap");
5929 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
5933 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
5937 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
5941 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
5945 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
5949 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
5953 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
5957 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
5961 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
5965 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
5969 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
5973 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
5977 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
5981 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
5985 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
5989 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
6005 PosPair.first = TrackElement.
HLoc;
6006 PosPair.second = TrackElement.
VLoc;
6010 Disp->
PlotOutput(283, TrackElement.
HLoc * 16, TrackElement.
VLoc * 16, MOMIt->second);
6023 throw Exception(
"Error, Wrong track type in PlotPoints");
6034 else if(TrackElement.
SpeedTag < 132)
6052 else if(TrackElement.
SpeedTag < 132)
6085 throw Exception(
"Error, Wrong track type in PlotSignal");
6087 for(
int x = 0; x < 40; x++)
6158 for(
int x = 0; x < 40; x++)
6165 Graphics::TBitmap* SignalPlatformGraphic;
6252 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
6260 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
6268 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
6276 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
6292 while(
IsLCAtHV(51, HLoc, (VLoc + UpStep)))
6300 while(
IsLCAtHV(52, HLoc, (VLoc + DownStep)))
6308 while(
IsLCAtHV(53, (HLoc + LeftStep), VLoc))
6316 while(
IsLCAtHV(54, (HLoc + RightStep), VLoc))
6349 while(
IsLCAtHV(55, HLoc, (VLoc + UpStep)))
6361 while(
IsLCAtHV(56, HLoc, (VLoc + DownStep)))
6373 while(
IsLCAtHV(57, (HLoc + LeftStep), VLoc))
6385 while(
IsLCAtHV(58, (HLoc + RightStep), VLoc))
6427 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
6429 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6431 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
6434 if(BaseElementSpeedTag == 1)
6438 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
6445 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
6453 Graphics::TBitmap *RouteGraphic;
6455 if(TypeOfRoute == 1)
6459 else if(TypeOfRoute == 0)
6465 RouteGraphic = BaseGraphic;
6472 if(UpStep == DownStep)
6475 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
6485 else if((DownStep - UpStep) == 1)
6490 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6500 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6513 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6523 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6539 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6549 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6559 else if(DownStep == 0)
6562 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6572 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6585 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6595 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6605 for(
int x = (UpStep + 1); x < DownStep; x++)
6610 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
6614 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
6635 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
6642 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
6648 Graphics::TBitmap *RouteGraphic;
6650 if(TypeOfRoute == 1)
6654 else if(TypeOfRoute == 0)
6660 RouteGraphic = BaseGraphic;
6669 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
6679 else if((RStep - LStep) == 1)
6684 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6694 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6707 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6717 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6733 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6743 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6756 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6766 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6779 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6789 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6799 for(
int x = (LStep + 1); x < RStep; x++)
6804 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
6808 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
6832 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6835 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6837 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6839 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6842 if(BaseElementSpeedTag == 1)
6846 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
6853 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
6859 if(UpStep == DownStep)
6870 else if((DownStep - UpStep) == 1)
6889 for(
int x = (UpStep + 1); x < DownStep; x++)
6898 for(
int x = (UpStep + 1); x < DownStep; x++)
6905 for(
int x = UpStep; x <= DownStep; x++)
6918 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
6925 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
6942 else if((RStep - LStep) == 1)
6961 for(
int x = (LStep + 1); x < RStep; x++)
6970 for(
int x = (LStep + 1); x < RStep; x++)
6977 for(
int x = LStep; x <= RStep; x++)
6996 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
6998 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7000 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
7003 if(BaseElementSpeedTag == 1)
7007 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
7014 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
7020 for(
int x = UpStep; x < (DownStep + 1); x++)
7035 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
7042 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
7048 for(
int x = LStep; x < (RStep + 1); x++)
7067 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7070 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7072 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7074 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7079 if(BaseElementSpeedTag == 1)
7083 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
7090 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
7096 for(
int x = UpStep; x <= DownStep; x++)
7110 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
7117 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
7123 for(
int x = LStep; x <= RStep; x++)
7139 Graphics::TBitmap *RouteGraphic;
7142 if(BaseElementSpeedTag == 1)
7144 if(TypeOfRoute == 1)
7148 else if(TypeOfRoute == 0)
7154 RouteGraphic = BaseGraphic;
7158 RouteGraphic = BaseGraphic;
7164 if(TypeOfRoute == 1)
7168 else if(TypeOfRoute == 0)
7174 RouteGraphic = BaseGraphic;
7178 RouteGraphic = BaseGraphic;
7183 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
7188 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
7192 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
7199 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
7202 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
7207 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
7212 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
7216 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
7223 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
7226 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
7351 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7355 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7386 "," + AnsiString(VLoc));
7390 int DummyRouteNumber;
7392 TrainPresent =
false;
7396 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
7398 TrackMapKeyPair.first = HLoc;
7399 TrackMapKeyPair.second = VLoc + UpStep;
7400 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7409 TrainPresent =
true;
7423 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
7425 TrackMapKeyPair.first = HLoc;
7426 TrackMapKeyPair.second = VLoc + DownStep;
7427 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7436 TrainPresent =
true;
7450 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
7452 TrackMapKeyPair.first = HLoc + LeftStep;
7453 TrackMapKeyPair.second = VLoc;
7454 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7463 TrainPresent =
true;
7477 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
7479 TrackMapKeyPair.first = HLoc + RightStep;
7480 TrackMapKeyPair.second = VLoc;
7481 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7490 TrainPresent =
true;
7510 for(
unsigned int x = 0; x < SearchVector.size(); x++)
7527 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7530 throw Exception(
"PlotSmallFlashingLinkedLevelCrossings");
7536 while(
IsLCAtHV(61, HLoc, (VLoc + UpStep)))
7543 while(
IsLCAtHV(62, HLoc, (VLoc + DownStep)))
7549 for(
int x = UpStep; x <= DownStep; x++)
7556 while(
IsLCAtHV(63, (HLoc + LStep), VLoc))
7563 while(
IsLCAtHV(64, (HLoc + RStep), VLoc))
7569 for(
int x = LStep; x <= RStep; x++)
7585 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
7592 else if(TrackElement.
SpeedTag < 132)
7610 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7627 AnsiString(ScreenPosV));
7642 AnsiString(ScreenPosV));
7653 AnsiString(VPosTrue));
7667 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7679 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7680 " in TrackMap, Caller=" + (AnsiString)Caller);
7682 if(MapVecPos != (
int)a)
7684 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7685 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
7686 (AnsiString)Caller);
7692 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7693 " Caller=" + (AnsiString)Caller);
7713 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7714 " in InactiveMap, Caller=" + (AnsiString)Caller);
7716 if((InactivePair.first != a) && (InactivePair.second != a))
7718 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7719 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
7720 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
7725 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7726 " Caller=" + (AnsiString)Caller);
7736 int Position1, Position2;
7742 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
7744 int HLoc1 = GapMapPtr->first.first;
7745 int VLoc1 = GapMapPtr->first.second;
7746 int HLoc2 = GapMapPtr->second.first;
7747 int VLoc2 = GapMapPtr->second.second;
7750 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
7754 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
7758 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
7762 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
7766 unsigned int GapCount = 0;
7768 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7776 if((
GapMap.size() * 2) != GapCount)
7778 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
7779 (AnsiString)Caller);
7789 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
7793 throw Exception(
"Error - TrackFinished with erase element still present");
7798 AnsiString IDString;
7800 if(TrackElement.
HLoc < 0)
7802 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
7806 IDString = AnsiString(TrackElement.
HLoc) +
"-";
7808 if(TrackElement.
VLoc < 0)
7810 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
7814 IDString += AnsiString(TrackElement.
VLoc);
7828 for(
int x = 1; x < String.Length() + 1; x++)
7830 if(String.IsDelimiter(
"-", x))
7835 if(x == String.Length())
7839 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
7849 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
7854 if(DelimPos == String.Length())
7858 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
7863 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
7867 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
7874 if(String.SubString(1, 1) !=
"N")
7876 for(
int x = 1; x < DelimPos; x++)
7878 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7882 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7889 if(String.SubString(1, 1) ==
"N")
7891 for(
int x = 2; x < DelimPos; x++)
7893 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7897 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7904 if(String.SubString(1, 1) ==
"N")
7906 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
7910 HLoc = String.SubString(1, DelimPos - 1).ToInt();
7912 if(String.SubString(DelimPos + 1, 1) !=
"N")
7914 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
7916 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7920 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7927 if(String.SubString(DelimPos + 1, 1) ==
"N")
7929 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
7931 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7935 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7942 if(String.SubString(DelimPos + 1, 1) ==
"N")
7944 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
7948 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
7953 TrackMapPtr =
TrackMap.find(HVPair);
7958 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
7964 return(TrackMapPtr->second);
7975 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
7976 int HLoc = TrackElement.
HLoc;
7977 int VLoc = TrackElement.
VLoc;
8080 AnsiString(SpeedTag));
8091 if(HVRange.first == HVRange.second)
8098 HVIt1 = HVRange.first;
8103 if(--HVRange.second != HVRange.first)
8105 HVIt2 = HVRange.second;
8109 HVIt2->second).
SpeedTag == SpeedTag)))
8129 AnsiString(SpeedTag));
8195 AnsiString TestString1, TestString2;
8200 throw Exception(
"LNPendingList size not 1 on entry");
8202 int CurrentElementNumber;
8208 int H = CurrentElement->HLoc;
8209 int V = CurrentElement->VLoc;
8210 int Tag = CurrentElement->SpeedTag;
8216 for(
int x = 0; x < 25; x++)
8226 for(
int x = 0; x < 25; x++)
8236 for(
int x = 0; x < 25; x++)
8246 for(
int x = 0; x < 25; x++)
8256 for(
int x = 0; x < 28; x++)
8266 for(
int x = 0; x < 8; x++)
8276 for(
int x = 0; x < 8; x++)
8286 for(
int x = 0; x < 4; x++)
8296 for(
int x = 0; x < 8; x++)
8306 for(
int x = 0; x < 8; x++)
8319 if(CurrentElementNumber > -1)
8324 if((ExistingName !=
"") && (ExistingName != LocationName))
8340 AddName(1, CurrentElement, LocationName);
8344 LNDone2MultiMapEntry.first = HVPair;
8355 bool FoundFlag, ErasedFlag =
false;
8357 if(SNRange.first != SNRange.second)
8361 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
8368 TVIt->LocationName =
"";
8369 TVIt->ActiveTrackElementName =
"";
8402 std::pair<AnsiString, char>TempMapPair;
8410 TempMapPair.second =
'x';
8428 AnsiString(SpeedTag));
8438 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
8445 int MapPos = -1 - Position;
8449 FoundElement = MapPos;
8465 FoundElement = IMPair.first;
8474 FoundElement = IMPair.second;
8495 AnsiString OldName = TrackElement->LocationName, ErrorString;
8497 TrackElement->LocationName = Name;
8498 int HLoc = TrackElement->HLoc;
8499 int VLoc = TrackElement->VLoc;
8513 if(ErrorString !=
"")
8515 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
8539 if(LNDone2MultiMapIterator->second == MapPos)
8566 if(*LNPendingListIterator == MapPos)
8639 if(NameBeingChecked !=
"")
8645 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8653 NameBeingChecked = LNMMRg.second->first;
8655 if(NameBeingChecked !=
"")
8661 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8682 if(LNMMIt->second < 0)
8692 HVPairsLinkedMap.insert(std::pair<THVPair, bool>(HVPair,
false));
8700 std::list<THVPair> HVLinkedList;
8703 HVPairsLinkedMap.begin()->second =
true;
8704 HVLinkedList.push_back(HVPairsLinkedMap.begin()->first);
8707 THVPair HVPairUnderExamination;
8708 THVPairsLinkedMap::iterator HVPLMIt;
8710 while(!HVLinkedList.empty())
8712 HVPairUnderExamination = HVLinkedList.front();
8713 HVLinkedList.pop_front();
8714 HVPairNew.first = HVPairUnderExamination.first;
8715 HVPairNew.second = HVPairUnderExamination.second - 1;
8716 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8717 if(HVPLMIt != HVPairsLinkedMap.end())
8719 if(!HVPLMIt->second)
8721 HVLinkedList.push_back(HVPLMIt->first);
8723 HVPLMIt->second =
true;
8725 HVPairNew.first = HVPairUnderExamination.first - 1;
8726 HVPairNew.second = HVPairUnderExamination.second;
8727 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8728 if(HVPLMIt != HVPairsLinkedMap.end())
8730 if(!HVPLMIt->second)
8732 HVLinkedList.push_back(HVPLMIt->first);
8734 HVPLMIt->second =
true;
8736 HVPairNew.first = HVPairUnderExamination.first;
8737 HVPairNew.second = HVPairUnderExamination.second + 1;
8738 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8739 if(HVPLMIt != HVPairsLinkedMap.end())
8741 if(!HVPLMIt->second)
8743 HVLinkedList.push_back(HVPLMIt->first);
8745 HVPLMIt->second =
true;
8747 HVPairNew.first = HVPairUnderExamination.first + 1;
8748 HVPairNew.second = HVPairUnderExamination.second;
8749 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8750 if(HVPLMIt != HVPairsLinkedMap.end())
8752 if(!HVPLMIt->second)
8754 HVLinkedList.push_back(HVPLMIt->first);
8756 HVPLMIt->second =
true;
8761 for(THVPairsLinkedMap::iterator HVPLMIt = HVPairsLinkedMap.begin(); HVPLMIt != HVPairsLinkedMap.end(); HVPLMIt++)
8763 if(!HVPLMIt->second)
8782 if(LocationName ==
"")
8793 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8800 ActiveTrackElementNameMapEntry.second = 0;
8822 bool FoundFlag, ErasedFlag =
false;
8826 if(SNRange.first != SNRange.second)
8829 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
8832 TVIt->LocationName =
"";
8833 TVIt->ActiveTrackElementName =
"";
8867 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
8869 AnsiString LocationName;
8878 if(LocationName !=
"")
8886 if(LocationName !=
"")
8900 if(LocationName !=
"")
8902 int ModifiedPosition = -1 - Position;
8911 for(
int x = 0; x < 25; x++)
8921 else if(SpeedTag == 77)
8923 for(
int x = 0; x < 25; x++)
8933 else if(SpeedTag == 78)
8935 for(
int x = 0; x < 25; x++)
8945 else if(SpeedTag == 79)
8947 for(
int x = 0; x < 25; x++)
8957 else if(SpeedTag == 96)
8959 for(
int x = 0; x < 28; x++)
8969 else if(SpeedTag == 129)
8971 for(
int x = 0; x < 8; x++)
8981 else if(SpeedTag == 130)
8983 for(
int x = 0; x < 8; x++)
8993 else if(SpeedTag == 145)
8995 for(
int x = 0; x < 8; x++)
9005 else if(SpeedTag == 146)
9007 for(
int x = 0; x < 8; x++)
9017 else if(SpeedTag == 131)
9019 for(
int x = 0; x < 4; x++)
9042 AnsiString(SpeedTag));
9054 if(TempElement->LocationName !=
"")
9056 LocationName = TempElement->LocationName;
9057 FoundElement = IMPair.first;
9065 if(TempElement->LocationName !=
"")
9067 LocationName = TempElement->LocationName;
9068 FoundElement = IMPair.second;
9080 if(TempElement->LocationName !=
"")
9082 LocationName = TempElement->LocationName;
9083 FoundElement = -1 - Position;
9099 unsigned int Count = 0;
9106 AnsiString SName, TName, ErrorString;
9108 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9114 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
9115 AnsiString(Caller));
9128 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
9129 AnsiString(Caller));
9136 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
9137 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9142 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9148 if(ErrorString !=
"")
9150 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
9152 if(SNIt->second != -1 - (
int)x)
9154 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9155 AnsiString(Caller));
9161 bool FoundFlag =
false;
9170 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackElementAt(1369, x).HLoc) +
" & V " +
9171 AnsiString(
TrackElementAt(1370, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9175 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackElementAt(1371, x).HLoc) +
9176 " & V " + AnsiString(
TrackElementAt(1372, x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
9177 AnsiString(Caller));
9182 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackElementAt(1373, x).HLoc) +
" & V " +
9183 AnsiString(
TrackElementAt(1374, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9193 if(ErrorString !=
"")
9195 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
9197 if(SNIt->second != (
int)x)
9199 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9200 AnsiString(Caller));
9210 AnsiString &ErrorString)
9218 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
9220 bool FoundFlag =
false;
9224 if(SNRange.first == SNRange.second)
9226 ErrorString =
"Error, Name " + LocationName +
" not found in map";
9228 return(SNRange.first);
9232 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9234 if(SNIterator->second < 0)
9236 int TVPos = -1 - SNIterator->second;
9238 if(TVIt == TrackElement)
9247 int ITVPos = SNIterator->second;
9249 if(ITVIt == TrackElement)
9260 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
9277 LocationNameEntry.first = NewName;
9278 LocationNameEntry.second = SNIterator->second;
9292 int TruePos = -1 - Position;
9296 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9306 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9329 InactiveTrack2MultiMapIterator++)
9331 if(InactiveTrack2MultiMapIterator->second > VecPos)
9333 InactiveTrack2MultiMapIterator->second--;
9341 LocationNameMultiMapIterator++)
9343 if(LocationNameMultiMapIterator->second < 0)
9347 if(LocationNameMultiMapIterator->second > (
int)VecPos)
9349 LocationNameMultiMapIterator->second--;
9371 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
9373 if(TrackMapIterator->second > VecPos)
9375 TrackMapIterator->second--;
9383 LocationNameMultiMapIterator++)
9385 if(LocationNameMultiMapIterator->second >= 0)
9391 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
9393 LocationNameMultiMapIterator->second++;
9397 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9403 if(TkEl.
Conn[0] ==
int(VecPos))
9408 if(TkEl.
Conn[0] >
int(VecPos))
9412 if(TkEl.
Conn[0] > -1)
9438 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
9444 LocationNameEntry.second = -1 - TVPos;
9455 LocationNameEntry.second = ITVPos;
9497 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9529 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9557 AnsiString((
short)FirstTrack));
9558 bool LengthDifferent =
false, SpeedDifferent =
false;
9565 int EXArray[16][2] =
9567 {2, 4}, {6, 2}, {8, 6}, {4, 8},
9568 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
9571 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
9572 Graphics::TBitmap *Bitmap;
9576 InLink = TrackElement.
Link[0];
9577 OutLink = TrackElement.
Link[1];
9581 InLink = TrackElement.
Link[2];
9582 OutLink = TrackElement.
Link[3];
9584 for(
int x = 0; x < 16; x++)
9586 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
9593 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLength");
9612 else if(TrackElement.
SpeedTag == 54)
9616 else if(TrackElement.
SpeedTag == 55)
9627 else if(TrackElement.
SpeedTag == 58)
9631 else if(TrackElement.
SpeedTag == 59)
9636 else if(Index == 14)
9642 else if(TrackElement.
SpeedTag == 52)
9646 else if(TrackElement.
SpeedTag == 57)
9651 else if(Index == 15)
9657 else if(TrackElement.
SpeedTag == 53)
9661 else if(TrackElement.
SpeedTag == 56)
9675 if(LengthDifferent && SpeedDifferent)
9743 else if(LengthDifferent && !SpeedDifferent)
9890 AnsiString((
short)FirstTrack));
9891 LengthDifferent =
false;
9892 SpeedDifferent =
false;
9897 LengthDifferent =
true;
9901 SpeedDifferent =
true;
9903 if(LengthDifferent || SpeedDifferent)
9916 LengthDifferent =
true;
9920 SpeedDifferent =
true;
9922 if(LengthDifferent || SpeedDifferent)
9935 LengthDifferent =
true;
9939 SpeedDifferent =
true;
9941 if(LengthDifferent || SpeedDifferent)
10021 AnsiString TempName;
10022 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
10023 bool ForwardSet, ReverseSet;
10025 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10030 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10032 ForwardSet =
false;
10033 ReverseSet =
false;
10068 for(
int y = 0; y < 2; y++)
10099 StartElement = TempElement;
10100 StartVecPos = VecPos;
10103 EntryPos = 1 - Dir;
10104 StartEntryPos = 1 - Dir;
10113 VecPos = TempElement.
Conn[1 - EntryPos];
10114 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10116 EntryPos = TempEntryPos;
10144 ForwardNumber = ((Count + 1) / 2) + 1;
10145 ReverseNumber = (Count - ForwardNumber) + 1;
10147 EntryPos = 1 - Dir;
10148 TempElement = StartElement;
10149 VecPos = StartVecPos;
10150 if(Count == ForwardNumber)
10155 if(Count == ReverseNumber)
10163 VecPos = TempElement.
Conn[1 - EntryPos];
10164 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10166 EntryPos = TempEntryPos;
10168 if(Count == ForwardNumber)
10173 if(Count == ReverseNumber)
10185 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10321 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10377 if((TextH / 16) - 1 <
HLocMin)
10381 if((TextH / 16) + 1 >
HLocMax)
10385 if((TextV / 16) - 1 <
VLocMin)
10389 if((TextV / 16) + 1 >
VLocMax)
10419 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
10420 bool &UserGraphicFoundFlag)
10423 TUserGraphicVector::iterator UserGraphicPtr;
10425 UserGraphicFoundFlag =
false;
10432 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
10433 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
10435 UserGraphicItem = x;
10436 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
10437 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
10438 UserGraphicFoundFlag =
true;
10456 int SpeedTag = TrackElement.
SpeedTag;
10460 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
10509 return(GraphicOutput);
10517 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10520 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
10533 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
10534 " in InactiveTrackElementAt");
10545 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10547 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
10572 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10573 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10577 if(SNRange.first == SNRange.second)
10582 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10584 if(SNIterator->second < 0)
10598 HVPair.first = InactiveElement.
HLoc;
10599 HVPair.second = InactiveElement.
VLoc;
10603 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNamedLocationLongEnoughForSplit (1)");
10605 int TVPos =
TrackMap.find(HVPair)->second;
10608 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10614 FirstNamedExitPos = 0;
10616 SecondNamedElement =
TrackElementAt(561, FirstNamedElement.
Conn[FirstNamedExitPos]);
10618 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10619 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10622 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10624 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
10625 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10626 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10629 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10639 FirstNamedExitPos = 1;
10641 SecondNamedElement =
TrackElementAt(564, FirstNamedElement.
Conn[FirstNamedExitPos]);
10643 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10644 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10647 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10649 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
10650 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10651 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10654 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10670 int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
10684 AnsiString(FirstNamedElementPos));
10685 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10686 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10688 SecondNamedElementPos = -1;
10689 FirstNamedLinkedElementPos = -1;
10690 SecondNamedLinkedElementPos = -1;
10694 if(SNRange.first == SNRange.second)
10699 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10701 if(SNIterator->second < 0)
10711 HVPair.first = InactiveElement.
HLoc;
10712 HVPair.second = InactiveElement.
VLoc;
10724 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in ThisNamedLocationLongEnoughForSplit (2)"
10728 int TVPos =
TrackMap.find(HVPair)->second;
10729 if(TVPos != FirstNamedElementPos)
10735 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10741 FirstNamedExitPos = 0;
10743 SecondNamedElement =
TrackElementAt(568, FirstNamedElement.
Conn[FirstNamedExitPos]);
10745 FirstNamedLinkedElement =
TrackElementAt(569, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10746 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10749 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10751 SecondNamedLinkedElement =
TrackElementAt(570, SecondNamedElement.
Conn[SecondNamedExitPos]);
10752 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10753 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10756 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10758 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10759 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10760 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10769 FirstNamedExitPos = 1;
10771 SecondNamedElement =
TrackElementAt(571, FirstNamedElement.
Conn[FirstNamedExitPos]);
10773 FirstNamedLinkedElement =
TrackElementAt(572, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10774 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10777 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10779 SecondNamedLinkedElement =
TrackElementAt(573, SecondNamedElement.
Conn[SecondNamedExitPos]);
10780 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10781 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10784 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10786 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10787 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10788 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10809 if(SNRange.first != SNRange.second)
10811 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10813 if(SNIterator->second < 0)
10835 "," + AnsiString(SpeedTag));
10846 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
10876 else if(SpeedTag == 69)
10902 else if(SpeedTag == 70)
10928 else if(SpeedTag == 71)
10965 AnsiString(NextEntryPos) +
"," + AnsiString(OwnTrainID));
10966 if(NextEntryPos < 0)
10979 if(NextEntryPos > 1)
10998 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
11010 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
11011 bool FoundFlag =
false;
11026 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
11027 bool FoundFlag =
false;
11052 VPosHi = 16 * VLocHi;
11053 VPosLo = 16 * VLocLo;
11072 AnsiString(EndTVPosition));
11083 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
11084 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
11085 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
11086 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
11088 if(Link0Squares <= Link1Squares)
11106 AnsiString(LinkPos));
11125 if((LinkPos == 1) && (TE.
Attribute == 0))
11130 else if(LinkPos == 1)
11136 else if((LinkPos == 3) && (TE.
Attribute == 1))
11141 else if(LinkPos == 3)
11148 else if(LinkPos == 0)
11153 else if(LinkPos == 1)
11158 else if(LinkPos == 2)
11163 else if(LinkPos == 3)
11168 throw Exception(
"Error, failure in GetExitPos");
11217 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
11221 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
11263 "," + AnsiString(DiagonalLinkNumber));
11268 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
11273 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
11278 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
11283 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
11299 AnsiString JustFileName =
"";
11304 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
11311 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
11330 typedef std::list<int> TNamePosList;
11331 TNamePosList NamePosList;
11332 typedef TNamePosList::iterator TNPLIt;
11334 typedef std::list<int> TOnePlatList;
11335 TOnePlatList OnePlatList;
11336 typedef TOnePlatList::iterator TOPLIt;
11339 NamePosList.clear();
11340 OnePlatList.clear();
11341 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11343 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
11345 NamePosList.push_back(x);
11350 if(!NamePosList.empty())
11352 OnePlatList.push_back(NamePosList.back());
11353 NamePosList.pop_back();
11355 while(!OnePlatList.empty())
11357 TempInt = OnePlatList.front();
11360 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
11361 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
11363 OnePlatList.push_back(TempElement.
Conn[0]);
11364 NamePosList.erase(NPLIt);
11366 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
11367 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
11369 OnePlatList.push_back(TempElement.
Conn[1]);
11370 NamePosList.erase(NPLIt);
11373 OnePlatList.erase(OnePlatList.begin());
11374 if(OnePlatList.empty())
11377 if(!NamePosList.empty())
11379 OnePlatList.push_back(NamePosList.back());
11380 NamePosList.pop_back();
11397 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
11412 throw Exception(
"Return value negative in call to LastElementNumber");
11424 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
11438 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
11450 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
11451 " in GetModifiablePrefDirElementAt");
11461 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11463 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
11473 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11475 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
11492 int TrackVectorPosition;
11544 FinishElement =
false;
11545 int TrackVectorPosition;
11567 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
11577 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
11600 for(
int x = 0; x < 4; x++)
11623 FinishElement =
true;
11631 for(
int x = 0; x < 4; x++)
11643 FinishElement =
true;
11651 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11658 .ELinkPos] ==
Lead))
11674 FinishElement =
true;
11693 FinishElement =
true;
11712 FinishElement =
true;
11727 FinishElement =
true;
11736 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11752 FinishElement =
true;
11758 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11781 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
11782 int VectorCount = 0;
11786 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
11788 for(
int x = 0; x < VectorCount; x++)
11795 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
11799 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
11800 SearchElement.
ELinkPos = NextELinkPos;
11821 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
11823 SearchElement.
XLinkPos = NextXLinkPos;
11849 for(
int x = 0; x < VectorCount; x++)
11861 for(
int x = 0; x < VectorCount; x++)
11875 for(
int x = 0; x < VectorCount; x++)
11889 for(
int x = 0; x < VectorCount; x++)
11899 for(
int x = 0; x < VectorCount; x++)
11910 SearchElement.
XLink = SearchElement.
Link[1];
11929 SearchElement.
XLink = SearchElement.
Link[3];
11942 for(
int x = 0; x < VectorCount; x++)
11957 XLinkPos = NextXLinkPos;
11958 CurrentTrackElement = SearchElement;
11977 throw Exception(
"Error, SearchVector empty");
11984 for(
int x = 0; x < 4; x++)
12037 throw Exception(
"Error in EntryExitNumber 1");
12056 if(PrefDirElement.
XLink == -1)
12068 if(PrefDirElement.
XLink != -1)
12072 throw Exception(
"Error in EntryExitNumber 2");
12110 LeadingPoints =
false;
12138 LeadingPoints =
true;
12154 AnsiString ErrorString;
12155 bool Error =
false;
12162 ErrorString =
"HLoc";
12168 ErrorString =
"VLoc";
12174 ErrorString =
"ELink";
12180 ErrorString =
"ELinkPos";
12186 ErrorString =
"XLink";
12192 ErrorString =
"XLinkPos";
12198 ErrorString =
"Tag";
12204 ErrorString =
"TrackVectorPosition";
12210 ErrorString =
"EXNumber";
12217 ErrorString =
"CheckCount";
12224 ErrorString =
"EntryGraphicPtr";
12230 ErrorString =
"EntryDirectionGraphicPtr";
12239 ErrorString =
"Last XLink not connected to this element";
12246 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
12270 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
12327 AnsiString((
short)BuildingPrefDir));
12330 if(PrefDirSize() == 0)
12335 for(
unsigned int x = 0; x < PrefDirSize(); x++)
12347 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
12359 if(x == (PrefDirSize() - 1))
12368 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
12370 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
12371 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
12372 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
12374 if(PrefDirSize() > 1)
12376 unsigned int LatestPos = PrefDirSize() - 1;
12377 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
12378 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
12379 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
12400 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12403 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
12407 H = MMIT->first.first;
12408 V = MMIT->first.second;
12411 if(PrefDirPos0 > -1)
12415 if(PrefDirPos1 > -1)
12419 if(PrefDirPos2 > -1)
12423 if(PrefDirPos3 > -1)
12427 if(PrefDirPos3 > -1)
12443 else if(PrefDirPos2 > -1)
12485 else if(PrefDirPos1 > -1)
12508 else if(PrefDirPos0 > -1)
12527 int NumberOfPrefDirElements = 0;
12530 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12532 VecFile >> TempInt;
12535 VecFile >> TempInt;
12536 LoadPrefDirElement.
ELink = TempInt;
12537 VecFile >> TempInt;
12538 LoadPrefDirElement.
ELinkPos = TempInt;
12539 VecFile >> TempInt;
12540 LoadPrefDirElement.
XLink = TempInt;
12541 VecFile >> TempInt;
12542 LoadPrefDirElement.
XLinkPos = TempInt;
12543 VecFile >> TempInt;
12544 LoadPrefDirElement.
EXNumber = TempInt;
12545 VecFile >> TempInt;
12550 if(!(LoadPrefDirElement.
IsARoute))
12576 int NumberOfPrefDirElements = 0;
12579 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12581 VecFile >> TempInt;
12582 VecFile >> TempInt;
12585 VecFile >> TempInt;
12586 LoadPrefDirElement.
ELink = TempInt;
12587 VecFile >> TempInt;
12588 LoadPrefDirElement.
ELinkPos = TempInt;
12589 VecFile >> TempInt;
12590 LoadPrefDirElement.
XLink = TempInt;
12591 VecFile >> TempInt;
12592 LoadPrefDirElement.
XLinkPos = TempInt;
12593 VecFile >> TempInt;
12594 LoadPrefDirElement.
EXNumber = TempInt;
12595 VecFile >> TempInt;
12600 if(!(LoadPrefDirElement.
IsARoute))
12628 int NumberOfPrefDirElements = 0;
12631 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
12636 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12643 VecFile >> TempInt;
12644 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
12649 VecFile >> TempInt;
12650 if((TempInt < -1) || (TempInt > 9))
12655 VecFile >> TempInt;
12656 if((TempInt < -1) || (TempInt > 3))
12661 VecFile >> TempInt;
12662 if((TempInt < -1) || (TempInt > 9))
12667 VecFile >> TempInt;
12668 if((TempInt < -1) || (TempInt > 3))
12673 VecFile >> TempInt;
12674 if((TempInt < -1) || (TempInt > 27))
12679 VecFile >> TempInt;
12687 VecFile >> TempInt;
12688 if((TempInt != 0) && (TempInt != 1))
12693 VecFile >> TempInt;
12694 if((TempInt != 0) && (TempInt != 1))
12699 VecFile >> TempInt;
12700 if((TempInt != 0) && (TempInt != 1))
12723 for(
int y = 0; y < NumberOfPrefDirElements; y++)
12725 VecFile << y <<
'\n';
12726 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
12736 if(y == (NumberOfPrefDirElements - 1))
12738 VecFile <<
"************" <<
'\0' <<
'\n';
12742 VecFile <<
"******" <<
'\0' <<
'\n';
12756 for(
int y = 0; y < NumberOfSearchElements; y++)
12758 VecFile << y <<
'\n';
12759 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
12769 if(y == (NumberOfSearchElements - 1))
12771 VecFile <<
"************" <<
'\0' <<
'\n';
12775 VecFile <<
"******" <<
'\0' <<
'\n';
12888 bool AlreadyPresent, FoundFlag;
12889 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12891 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
12895 AlreadyPresent =
false;
12900 AlreadyPresent =
true;
12904 AlreadyPresent =
true;
12908 AlreadyPresent =
true;
12912 AlreadyPresent =
true;
12915 if(!AlreadyPresent)
12962 for(
unsigned int z = 0; z < 4; z++)
12970 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
12984 bool DiscrepancyFound =
false;
12995 DiscrepancyFound =
true;
13000 DiscrepancyFound =
true;
13005 DiscrepancyFound =
true;
13010 DiscrepancyFound =
true;
13015 DiscrepancyFound =
true;
13021 DiscrepancyFound =
true;
13024 if(DiscrepancyFound)
13026 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
13041 bool DiscrepancyFound =
false;
13052 DiscrepancyFound =
true;
13056 DiscrepancyFound =
true;
13061 DiscrepancyFound =
true;
13066 DiscrepancyFound =
true;
13071 DiscrepancyFound =
true;
13077 DiscrepancyFound =
true;
13081 return(!DiscrepancyFound);
13093 bool FoundFlag =
false;
13094 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
13102 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
13103 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
13105 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
13107 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
13108 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
13109 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
13114 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
13115 +
" Caller=" + (AnsiString)Caller);
13141 PrefDirMapKeyPair.first = HLoc;
13142 PrefDirMapKeyPair.second = VLoc;
13143 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13146 if(ItPair.first == ItPair.second)
13154 PrefDirPos0 = ItPair.first->second;
13156 if(ItPair.first == ItPair.second)
13161 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13163 PrefDirPos1 = ItPair.first->second;
13166 if(ItPair.first == ItPair.second)
13171 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13173 PrefDirPos2 = ItPair.first->second;
13176 if(ItPair.first == ItPair.second)
13181 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13183 PrefDirPos3 = ItPair.first->second;
13198 +
"," + AnsiString(LinkNumberPos));
13200 int PD0, PD1, PD2, PD3;
13201 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
13205 PD0, PD1, PD2, PD3);
13217 LinkedPrefDirVectorNumber = PD0;
13226 LinkedPrefDirVectorNumber = PD1;
13236 LinkedPrefDirVectorNumber = PD0;
13245 LinkedPrefDirVectorNumber = PD1;
13254 LinkedPrefDirVectorNumber = PD2;
13263 LinkedPrefDirVectorNumber = PD3;
13268 LinkedPrefDirVectorNumber = -1;
13274 LinkedPrefDirVectorNumber = -1;
13279 catch(
const Exception &e)
13281 LinkedPrefDirVectorNumber = -1;
13293 int PD0, PD1, PD2, PD3;
13345 THVPair PrefDir4MultiMapKeyPair;
13348 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
13349 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
13350 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
13373 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
13392 AnsiString(ErasedElementNumber));
13397 if(MapPtr->second > ErasedElementNumber)
13419 throw Exception(
"PrefDirVectorPosition out of range");
13422 THVPair PrefDir4MultiMapKeyPair;
13424 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
13425 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
13426 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13429 if(ItPair.first == ItPair.second)
13432 return(ItPair.first);
13436 if(ItPair.first->second == PrefDirVectorPosition)
13440 return(ItPair.first);
13443 if(ItPair.first == ItPair.second)
13446 return(ItPair.first);
13448 if(ItPair.first->second == PrefDirVectorPosition)
13452 return(ItPair.first);
13455 if(ItPair.first == ItPair.second)
13458 return(ItPair.first);
13460 if(ItPair.first->second == PrefDirVectorPosition)
13464 return(ItPair.first);
13467 if(ItPair.first == ItPair.second)
13470 return(ItPair.first);
13472 if(ItPair.first->second == PrefDirVectorPosition)
13476 return(ItPair.first);
13480 return(ItPair.first);
13493 THVPair PrefDir4MultiMapKeyPair;
13495 PrefDir4MultiMapKeyPair.first = HLoc;
13496 PrefDir4MultiMapKeyPair.second = VLoc;
13497 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13500 if(ItPair.first == ItPair.second)
13508 return(ItPair.first->second);
13517 bool ErasedFlag =
false;
13519 if(ErasedTrackVectorPosition > -1)
13528 ErasedFlag =
false;
13530 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
13535 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
13540 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
13545 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
13550 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
13558 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
13562 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
13566 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
13570 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
13574 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
13589 OverallDistance = 0;
13590 OverallSpeedLimit = 0;
13591 LeadingPointsAtLastElement =
false;
13599 LeadingPointsAtLastElement =
true;
13608 OverallDistance += PrefDirElement.
Length23;
13609 if(OverallSpeedLimit != -1)
13619 OverallSpeedLimit = -1;
13626 OverallDistance += PrefDirElement.
Length01;
13627 if(OverallSpeedLimit != -1)
13637 OverallSpeedLimit = -1;
13656 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13659 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13663 HLoc = MMIT->first.first;
13664 VLoc = MMIT->first.second;
13669 if(PrefDirPos0 > -1)
13673 if(PrefDirPos1 > -1)
13677 if(PrefDirPos2 > -1)
13681 if(PrefDirPos3 > -1)
13685 if(PrefDirPos3 > -1)
13688 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13690 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13692 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13694 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
13701 else if(PrefDirPos2 > -1)
13706 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13708 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13710 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
13719 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13721 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13723 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
13732 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13734 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13736 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13743 else if(PrefDirPos1 > -1)
13748 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13750 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13758 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13760 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
13766 else if(PrefDirPos0 > -1)
13768 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13785 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13788 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13809 if(PrefDirPos0 > -1)
13813 if(PrefDirPos1 > -1)
13817 if(PrefDirPos2 > -1)
13821 if(PrefDirPos3 > -1)
13825 if(PrefDirPos3 > -1)
13830 else if(PrefDirPos2 > -1)
13832 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
13843 else if(PrefDirPos1 > -1)
13845 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
13856 else if(PrefDirPos0 > -1)
13858 if(PrefDirElement0.
XLinkPos == EntryPos)
13895 ElementIn.
VLoc +
"," + XLink);
13897 bool TrackFoundFlag;
13900 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
13912 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
13922 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
13936 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
13946 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
13960 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
13970 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
13984 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
13994 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
14017 bool FoundFlag, ContFlag, FoundElements =
false;
14018 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14023 LastIteratorValue++;
14048 if(PDVIt->XLinkPos == 0)
14053 StartElement = *PDVIt;
14062 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
14064 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14065 if(PrefDirPos0 == -1)
14069 bool NextElementFoundFlag =
false;
14073 NextElementFoundFlag =
true;
14075 if(PrefDirPos1 > -1)
14080 NextElementFoundFlag =
true;
14083 if(PrefDirPos2 > -1)
14088 NextElementFoundFlag =
true;
14091 if(PrefDirPos3 > -1)
14096 NextElementFoundFlag =
true;
14099 if(!NextElementFoundFlag)
14129 EndElement = NextElement;
14133 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
14135 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14136 if(PrefDirPos0 == -1)
14146 if(PrefDirPos1 > -1)
14154 if(PrefDirPos2 > -1)
14162 if(PrefDirPos3 > -1)
14193 FoundElements =
true;
14227 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
14229 int TrackVectorPosition;
14265 int LockedVectorNumber;
14288 bool InPrefDirFlag =
false;
14291 int PrefDirPos0 = -1;
14292 int PrefDirPos1 = -1;
14293 int PrefDirPos2 = -1;
14294 int PrefDirPos3 = -1;
14298 int PrefDirVecPos[4] =
14300 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14303 for(
int x = 0; x < 4; x++)
14305 int b = PrefDirVecPos[x];
14315 InPrefDirFlag =
true;
14329 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14337 if(DummyPair.first > -1)
14339 throw Exception(
"Selection in two routes - should never happen!");
14341 if(RoutePair.first > -1)
14417 IDInt &ReqPosRouteID,
bool &PointsChanged)
14451 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignals) +
"," + AnsiString((
short)AutoSigsFlag));
14501 bool InPrefDirFlag =
false;
14504 int PrefDirPos0 = -1;
14505 int PrefDirPos1 = -1;
14506 int PrefDirPos2 = -1;
14507 int PrefDirPos3 = -1;
14510 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14511 int PrefDirVecPos[4] =
14513 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14516 for(
int x = 0; x < 4; x++)
14518 int b = PrefDirVecPos[x];
14521 InPrefDirFlag =
true;
14535 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14544 if(RoutePair.first > -1)
14546 if(RoutePair.second != 0)
14563 EndElement1 = RouteElement;
14564 EndElement2 = BlankElement;
14664 PointsChanged =
true;
14692 PointsChanged =
true;
14715 PointsChanged =
true;
14744 PointsChanged =
true;
14758 PointsChanged =
true;
14777 PointsChanged =
true;
14791 PointsChanged =
true;
14807 PointsChanged =
true;
14861 TOnePrefDir *EveryPrefDir,
bool ConsecSignals,
int EndPosition,
bool AutoSigsFlag)
14914 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
14915 AnsiString((
short)AutoSigsFlag));
14916 int VectorCount = 0;
14920 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
14924 for(
int x = 0; x < VectorCount; x++)
14932 bool FirstPass =
true;
14942 for(
int x = 0; x < VectorCount; x++)
14951 for(
int x = 0; x < VectorCount; x++)
14963 for(
int x = 0; x < VectorCount; x++)
14971 int NextPosition = PrefDirElement.
Conn[XLinkPos];
14975 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
14976 SearchElement.
ELinkPos = NextELinkPos;
14977 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
14998 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
15000 SearchElement.
XLinkPos = NextXLinkPos;
15012 for(
int x = 0; x < VectorCount; x++)
15026 if(RoutePair.first > -1)
15035 for(
int x = 0; x < VectorCount; x++)
15044 if(SecondPair.first > -1)
15053 for(
int x = 0; x < VectorCount; x++)
15067 for(
int x = 0; x < VectorCount; x++)
15078 for(
int x = 0; x < VectorCount; x++)
15087 for(
int x = 0; x < VectorCount; x++)
15096 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15100 for(
int x = 0; x < VectorCount; x++)
15110 bool InPrefDirFlag =
false;
15111 PrefDirElement1 = BlankElement;
15112 PrefDirElement2 = BlankElement;
15115 int PrefDirPos0 = -1;
15116 int PrefDirPos1 = -1;
15117 int PrefDirPos2 = -1;
15118 int PrefDirPos3 = -1;
15121 int PrefDirVecPos[4] =
15123 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15125 for(
int x = 0; x < 4; x++)
15127 int b = PrefDirVecPos[x];
15130 InPrefDirFlag =
true;
15143 for(
int x = 0; x < VectorCount; x++)
15155 for(
int x = 0; x < VectorCount; x++)
15171 for(
int x = 0; x < VectorCount; x++)
15191 for(
int x = 0; x < VectorCount; x++)
15208 for(
int x = 0; x < VectorCount; x++)
15218 for(
int x = 0; x < VectorCount; x++)
15229 int SearchPos1 = SearchElement.
Attribute + 1;
15231 if(SearchPos1 == 2)
15235 if(SearchPos1 == 1)
15243 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
15244 SearchElement.
XLinkPos = SearchPos1;
15245 InPrefDirFlag =
false;
15246 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15248 SearchElement = PrefDirElement1;
15249 InPrefDirFlag =
true;
15251 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15253 SearchElement = PrefDirElement2;
15254 InPrefDirFlag =
true;
15260 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15264 for(
int x = 0; x < VectorCount; x++)
15291 for(
int x = 0; x < VectorCount; x++)
15309 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
15310 SearchElement.
XLinkPos = SearchPos2;
15311 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15313 SearchElement = PrefDirElement1;
15315 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15317 SearchElement = PrefDirElement2;
15321 for(
int x = 0; x < VectorCount; x++)
15329 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15333 for(
int x = 0; x < VectorCount; x++)
15361 for(
int x = 0; x < VectorCount; x++)
15373 for(
int x = 0; x < VectorCount; x++)
15383 SearchElement = PrefDirElement1;
15392 XLinkPos = SearchElement.
XLinkPos;
15393 PrefDirElement = SearchElement;
15450 unsigned int TruncatePrefDirPosition = 0;
15523 throw Exception(
"Error - failed to validate extended route for preferred route");
15578 throw Exception(
"Error - failed to validate single route for preferred route");
15623 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
15625 int TrackVectorPosition;
15662 int LockedVectorNumber;
15696 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
15697 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
15700 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
15706 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
15707 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
15710 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
15724 if(RoutePair.first > -1)
15922 EndElement1.
ELink = EndElement1.
Link[0];
15923 EndElement1.
XLink = EndElement1.
Link[1];
15926 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
15931 EndElement2.
ELink = EndElement2.
Link[1];
15932 EndElement2.
XLink = EndElement2.
Link[0];
15935 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
15979 if(RoutePair.first > -1)
15981 if(RoutePair.second != 0)
16004 EndElement2 = BlankElement;
16089 PointsChanged =
true;
16115 PointsChanged =
true;
16137 PointsChanged =
true;
16163 PointsChanged =
true;
16177 PointsChanged =
true;
16217 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
16218 int VectorCount = 0;
16221 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
16222 (CurrentTrackElement.
Link[XLinkPos] == 9))
16226 for(
int x = 0; x < VectorCount; x++)
16238 for(
int x = 0; x < VectorCount; x++)
16245 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
16247 for(
int x = 0; x < VectorCount; x++)
16254 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
16258 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
16259 SearchElement.
ELinkPos = NextELinkPos;
16280 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
16282 SearchElement.
XLinkPos = NextXLinkPos;
16295 for(
int x = 0; x < VectorCount; x++)
16309 if(RoutePair.first > -1)
16318 for(
int x = 0; x < VectorCount; x++)
16327 if(SecondPair.first > -1)
16336 for(
int x = 0; x < VectorCount; x++)
16350 for(
int x = 0; x < VectorCount; x++)
16361 for(
int x = 0; x < VectorCount; x++)
16370 for(
int x = 0; x < VectorCount; x++)
16379 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16383 for(
int x = 0; x < VectorCount; x++)
16396 for(
int x = 0; x < VectorCount; x++)
16428 for(
int x = 0; x < VectorCount; x++)
16438 for(
int x = 0; x < VectorCount; x++)
16449 int SearchPos1 = SearchElement.
Attribute + 1;
16451 if(SearchPos1 == 2)
16455 if(SearchPos1 == 1)
16464 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
16465 SearchElement.
XLinkPos = SearchPos1;
16467 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16471 for(
int x = 0; x < VectorCount; x++)
16496 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
16497 SearchElement.
XLinkPos = SearchPos2;
16499 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16503 for(
int x = 0; x < VectorCount; x++)
16522 for(
int x = 0; x < VectorCount; x++)
16537 CurrentTrackElement = SearchElement;
16538 XLinkPos = SearchElement.
XLinkPos;
16560 throw Exception(
"Error, SearchVector empty");
16572 for(
int x = 0; x < 4; x++)
16614 throw Exception(
"Error in EntryExitNumber 3");
16669 unsigned int TruncatePrefDirPosition = 0;
16729 throw Exception(
"Failed to validate extended route for nonpreferred route");
16774 throw Exception(
"Failed to validate single route for nonpreferred route");
16794 if(!PrefDirVector.empty())
16798 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
16803 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
16838 if(!PrefDirVector.empty())
16841 TPrefDirElement LastElement = GetFixedPrefDirElementAt(185, PrefDirSize() - 1);
16843 int ForwardLinkedRouteNumber, Attribute = 0;
16850 if(ForwardLinkedRouteNumber > -1)
16852 int NextForwardLinkedRouteNumber = -1;
16856 ForwardLinkedRouteNumber = NextForwardLinkedRouteNumber;
16866 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
16886 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
16894 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
16925 NextForwardLinkedRouteNumber = -1;
16926 for(
unsigned int x = 0; x < PrefDirSize(); x++)
16928 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
16929 if(PrefDirVector.at(x).TrackType ==
Bridge)
16931 if(PrefDirVector.at(x).XLinkPos < 2)
16933 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos01;
16937 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos23;
16945 if(PrefDirVector.at(x).TrackType ==
Buffers)
16957 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
16966 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
16968 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute + 1;
16976 if(x == PrefDirSize() - 1)
17020 AnsiString(PrefDirVectorStartPosition));
17025 bool SkipContinuationAndBufferAttributeChange =
false;
17027 if(!PrefDirVector.empty())
17029 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
17032 if(PrefDirPtr->TrackType ==
Bridge)
17034 if(PrefDirPtr->XLinkPos < 2)
17045 SkipContinuationAndBufferAttributeChange =
true;
17060 SkipContinuationAndBufferAttributeChange =
true;
17068 SkipContinuationAndBufferAttributeChange =
true;
17070 if(!SkipContinuationAndBufferAttributeChange)
17072 if(PrefDirVector.back().TrackType ==
Buffers)
17081 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
17084 if(PrefDirPtr->TrackType ==
Bridge)
17086 if(PrefDirPtr->XLinkPos < 2)
17102 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
17111 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
17113 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
17114 PrefDirPtr->PrefDirRoute)
17118 int LockedVecNum = 0;
17120 bool KeepAttributeAt0ForLockedRoute =
false;
17125 KeepAttributeAt0ForLockedRoute =
true;
17145 if((Attribute < 3) && !KeepAttributeAt0ForLockedRoute)
17173 "," + AnsiString((
short)PrefDirRoute));
17174 bool ElementInRoute =
false;
17175 bool TrainOccupyingRoute =
false;
17181 ElementInRoute =
true;
17185 if(!ElementInRoute)
17213 TrainOccupyingRoute =
true;
17280 if(LRVIT->RouteNumber == RouteNumber)
17294 int button = Application->MessageBox(L
"Train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
17295 L
"Warning!", MB_YESNO | MB_ICONWARNING);
17307 bool ExistingLockedRouteModified =
false;
17320 if(LRVIT->RouteNumber == RouteNumber)
17324 ExistingLockedRouteModified =
true;
17328 if(!ExistingLockedRouteModified)
17418 AnsiString((
short)PrefDirRoute));
17443 AnsiString((
short)PrefDirRoute));
17453 RouteFlashElement.
HLoc = H;
17454 RouteFlashElement.
VLoc = V;
17470 int H = PrefDirPtr->HLoc;
17471 int V = PrefDirPtr->VLoc;
17538 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
17544 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
17547 OverlayPlotted =
false;
17557 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
17559 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
17562 return(AllRoutesVector.at(At));
17571 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
17573 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
17576 return(AllRoutesVector.at(At));
17587 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17589 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
17599 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17601 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
17619 AnsiString(VLoc) +
"," + AnsiString((
short)PrefDirRoute));
17620 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17623 RouteTruncateFlag =
true;
17625 GetModifiableRouteAt(7, a).GetRouteTruncateElement(0, HLoc, VLoc, PrefDirRoute, ReturnFlag);
17626 RouteTruncateFlag =
false;
17655 AnsiString(LinkPos));
17656 if(TrackVectorPosition == -1)
17661 THVPair Route2MultiMapKeyPair;
17665 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17668 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17678 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17680 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17683 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
17684 Route2MultiMapIterator->second.second);
17685 EntryLinkPos = PrefDirElement1.
ELinkPos;
17686 ExitLinkPos = PrefDirElement1.
XLinkPos;
17687 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17688 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17700 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17712 Graphics::TBitmap* &EntryDirectionGraphicPtr)
17722 AnsiString(LinkPos));
17725 if(TrackVectorPosition == -1)
17730 THVPair Route2MultiMapKeyPair;
17734 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17737 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17742 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17744 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17746 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
17747 Route2MultiMapIterator->second.second);
17748 EntryLinkPos = PrefDirElement1.
ELinkPos;
17749 ExitLinkPos = PrefDirElement1.
XLinkPos;
17750 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17751 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17755 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
17756 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
17763 return(AutoSigsRoute);
17768 return(NotAutoSigsRoute);
17774 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
17775 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
17782 return(AutoSigsRoute);
17787 return(NotAutoSigsRoute);
17791 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17793 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17794 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17796 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
17797 EntryLinkPos = PrefDirElement2.
ELinkPos;
17798 ExitLinkPos = PrefDirElement2.
XLinkPos;
17799 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
17800 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
17804 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
17811 return(AutoSigsRoute);
17816 return(NotAutoSigsRoute);
17822 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
17829 return(AutoSigsRoute);
17834 return(NotAutoSigsRoute);
17838 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
17839 EntryLinkPos = PrefDirElement3.
ELinkPos;
17840 ExitLinkPos = PrefDirElement3.
XLinkPos;
17841 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
17842 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
17846 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
17853 return(AutoSigsRoute);
17858 return(NotAutoSigsRoute);
17864 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
17871 return(AutoSigsRoute);
17876 return(NotAutoSigsRoute);
17892 AnsiString(LinkPos));
17893 if(TrackVectorPosition == -1)
17899 THVPair Route2MultiMapKeyPair;
17903 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17906 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17912 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17914 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17916 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
17917 Route2MultiMapIterator->second.second);
17918 EntryLinkPos = PrefDirElement1.
ELinkPos;
17919 ExitLinkPos = PrefDirElement1.
XLinkPos;
17920 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17921 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17924 RouteNumber = Route2MultiMapIterator->second.first;
17928 return(AutoSigsRoute);
17933 return(NotAutoSigsRoute);
17938 RouteNumber = Route2MultiMapIterator->second.first;
17942 return(AutoSigsRoute);
17947 return(NotAutoSigsRoute);
17951 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17953 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17954 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17956 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
17957 EntryLinkPos = PrefDirElement2.
ELinkPos;
17958 ExitLinkPos = PrefDirElement2.
XLinkPos;
17959 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
17960 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
17963 RouteNumber = ItPair.first->second.first;
17967 return(AutoSigsRoute);
17972 return(NotAutoSigsRoute);
17977 RouteNumber = ItPair.first->second.first;
17981 return(AutoSigsRoute);
17986 return(NotAutoSigsRoute);
17990 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
17991 EntryLinkPos = PrefDirElement3.
ELinkPos;
17992 ExitLinkPos = PrefDirElement3.
XLinkPos;
17993 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
17994 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
17997 RouteNumber = ItPair.second->second.first;
18001 return(AutoSigsRoute);
18006 return(NotAutoSigsRoute);
18011 RouteNumber = ItPair.second->second.first;
18015 return(AutoSigsRoute);
18020 return(NotAutoSigsRoute);
18042 EmptyRoute.
RouteID = NextRouteID;
18045 AllRoutesVector.push_back(EmptyRoute);
18046 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
18071 AllRoutesVector.push_back(EmptyRoute);
18072 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
18095 THVPair Route2MultiMapKeyPair;
18104 LockedRouteTruncateTrackVectorPosition = 0;
18105 LockedRouteLastTrackVectorPosition = 0;
18106 LockedRouteLastXLinkPos = 0;
18107 LockedRouteLockStartTime = TDateTime(0);
18108 if(!LockedRouteVector.empty())
18112 if(LRVIT->RouteNumber == RouteNumber)
18114 LockedRouteTruncateTrackVectorPosition = LRVIT->TruncateTrackVectorPosition;
18115 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
18116 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
18117 LockedRouteLockStartTime = LRVIT->LockStartTime;
18118 LockedRouteFoundDuringRouteBuilding =
true;
18119 LockedRouteVector.erase(LRVIT);
18144 AnsiString(VLoc) +
"," + AnsiString(ELink));
18147 ReturnPair.first = -1;
18148 ReturnPair.second = 0;
18149 THVPair Route2MultiMapKeyPair;
18151 Route2MultiMapKeyPair.first = HLoc;
18152 Route2MultiMapKeyPair.second = VLoc;
18155 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
18156 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18158 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18159 Route2MultiMapIterator = ItPair.first;
18161 if(ItPair.first == ItPair.second)
18163 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
18165 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
18167 ReturnPair.first = ItPair.first->second.first;
18168 ReturnPair.second = ItPair.first->second.second;
18169 Route2MultiMapIterator = ItPair.first;
18171 return(ReturnPair);
18174 if(ItPair.first == ItPair.second)
18176 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
18178 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
18180 ReturnPair.first = ItPair.first->second.first;
18181 ReturnPair.second = ItPair.first->second.second;
18182 Route2MultiMapIterator = ItPair.first;
18184 return(ReturnPair);
18187 return(ReturnPair);
18202 AnsiString(VLoc) +
"," + AnsiString(ELink));
18203 THVPair Route2MultiMapKeyPair;
18205 Route2MultiMapKeyPair.first = HLoc;
18206 Route2MultiMapKeyPair.second = VLoc;
18207 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18209 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18211 if(ItPair.first == ItPair.second)
18217 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
18219 RouteNumber = ItPair.first->second.first;
18225 if(ItPair.first == ItPair.second)
18231 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
18233 RouteNumber = ItPair.first->second.first;
18254 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
18255 THVPair Route2MultiMapKeyPair;
18257 Route2MultiMapKeyPair.first = HLoc;
18258 Route2MultiMapKeyPair.second = VLoc;
18261 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
18264 RouteElementPair.first = RouteNumber;
18265 RouteElementPair.second = RouteElementNumber;
18266 Route2MultiMapEntry.second = RouteElementPair;
18268 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
18271 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
18272 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
18275 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
18276 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
18278 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
18280 Route2MultiMap.insert(Route2MultiMapEntry);
18285 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
18290 Route2MultiMap.insert(Route2MultiMapEntry);
18308 TempPair.first = -1;
18309 TempPair.second = 0;
18310 SecondPair = TempPair;
18312 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
18313 THVPair Route2MultiMapKeyPair;
18315 Route2MultiMapKeyPair.first = HLoc;
18316 Route2MultiMapKeyPair.second = VLoc;
18317 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18322 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18324 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18326 return(Route2MultiMapIterator->second);
18328 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18330 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18331 TempPair = ItRange.first->second;
18332 SecondPair = (--ItRange.second)->second;
18355 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
18356 if(RouteElementPair.first == -1)
18359 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
18360 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
18362 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
18365 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
18366 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
18367 (AnsiString)Caller);
18369 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
18372 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
18373 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
18374 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
18375 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
18379 unsigned int SizeVal = 0;
18382 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
18384 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
18386 if(SizeVal != Route2MultiMap.size())
18388 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
18389 (AnsiString)Caller);
18405 if(!Route2MultiMap.empty())
18407 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
18409 if(Route2MultiMapIterator->second.first > RouteNumber)
18411 Route2MultiMapIterator->second.first--;
18428 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
18429 if(!Route2MultiMap.empty())
18431 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
18433 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
18435 Route2MultiMapIterator->second.second--;
18454 AnsiString(ELink));
18458 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
18459 if(RequiredRoutePair.first == -1)
18461 throw Exception(
"Failed to find route element in RemoveRouteElement");
18463 Route2MultiMap.erase(Route2MultiMapIterator);
18464 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
18467 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
18488 GetModifiableRouteAt(8, RequiredRoutePair.first).EraseRouteElementAt(&(GetModifiableRouteAt(9, RequiredRoutePair.first).GetModifiablePrefDirElementAt(1,
18489 RequiredRoutePair.second)));
18500 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
18508 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
18510 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
18511 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
18512 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
18524 if(!LockedRouteVector.empty())
18528 if(LRVIT->RouteNumber > RequiredRoutePair.first)
18530 LRVIT->RouteNumber--;
18540 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
18542 AutoSigVectorIT->RouteNumber--;
18547 CheckMapAndRoutes(7);
18561 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
18562 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
18563 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
18579 "," + AnsiString(XLinkPos));
18583 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
18584 if(RouteElementPair.first == -1)
18586 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
18588 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
18590 RequiredPair = RouteElementPair;
18591 if(RouteElement.
XLinkPos != XLinkPos)
18593 if(SecondPair.first != -1)
18595 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
18596 RequiredPair = SecondPair;
18597 if(RouteElement.
XLinkPos != XLinkPos)
18599 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
18604 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
18608 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
18628 AnsiString(AccessNumber));
18630 int Attribute = AccessNumber + 1;
18632 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
18636 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
18640 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
18643 x).XLinkPos] !=
End)
18645 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
18648 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
18691 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
18692 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
18693 int RearwardLinkedRouteNumber;
18719 int TrainID, TrainPosition, BehindTrainPosition;
18720 bool FoundTrain =
false, BehindTrain =
false;
18721 for(
int x = RouteStartPosition; x >= 0; x--)
18723 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
18748 if(FoundTrain && (TrainPosition > 1))
18750 for(
int x = TrainPosition; x >= 0; x--)
18755 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
18775 BehindTrain =
true;
18776 BehindTrainPosition = x;
18783 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
18800 AnsiString(RouteTruncatePosition));
18801 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber, StartPosition = RouteTruncatePosition;
18802 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
18805 bool ExamineRoute =
true;
18807 while(ExamineRoute)
18809 for(
int x = StartPosition; x >= 0; x--)
18851 if(SignalCount >= 3)
18870 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
18871 ExamineRoute =
true;
18872 StartPosition = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
18907 ExamineRoute =
false;
18922 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
18925 PrefDirElement = InternalPrefDirElement;
18926 if(LockedRouteVector.empty())
18933 bool InLockedRoute =
false;
18937 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
18941 InLockedRoute =
true;
18950 int RouteNumber, VectorCount = 0;
18955 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
18956 if(RouteType == NoRoute)
18962 GetFixedRouteAt(140, RouteNumber).
PrefDirSize() - 1).XLinkPos != LRVIT->LastXLinkPos))
18965 (
"Error, last element in locked route doesn't correspond with last element in associated route in IsElementInLockedRouteGetPrefDirElement");
18967 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
18969 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
18970 if(InternalPrefDirElement.
TrackVectorPosition != (
int)LRVIT->TruncateTrackVectorPosition)
18974 PrefDirElement = InternalPrefDirElement;
18975 LockedVectorNumber = VectorCount;
18980 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->TruncateTrackVectorPosition)
18984 PrefDirElement = InternalPrefDirElement;
18985 LockedVectorNumber = VectorCount;
19006 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19008 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
19014 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
19024 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19026 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
19041 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19043 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
19046 return(GetFixedRouteAt(159, x));
19049 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
19057 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19059 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
19062 return(GetModifiableRouteAt(15, x));
19065 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
19075 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
19077 TOneRoute OneRoute = GetFixedRouteAt(165, x);
19089 int NumberOfRoutes;
19093 for(
int x = 0; x < NumberOfRoutes; x++)
19100 StoreOneRouteAfterSessionLoad(0, &OneRoute);
19118 if((NumberOfRoutes < 0) || (NumberOfRoutes > 5000))
19125 if((NextID < 0) || (NextID > 1000000))
19130 for(
int x = 0; x < NumberOfRoutes; x++)
19155 AnsiString(StartPosition));
19156 if(EndPosition == StartPosition)
19162 int TVPos = EndPosition;
19163 int LkPos = EndXLinkPos;
19165 while(TrackIsInARoute(15, TVPos, LkPos))
19192 if(GetRouteTypeAndNumber(36, NewTVPos, NewLkPos, RouteNumber) == NoRoute)
19201 if((NewLkPos == 0) || (NewLkPos == 2))
19221 if(TVPos == StartPosition)
19253 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
19258 if(FirstPair.first > -1)
19261 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19266 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19272 if(SecondPair.first > -1)
19275 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19280 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19286 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
19293 if(FirstPair.first > -1)
19296 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19301 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19307 if(SecondPair.first > -1)
19310 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19315 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19321 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
19328 if(FirstPair.first > -1)
19331 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19336 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19342 if(SecondPair.first > -1)
19345 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19350 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19356 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
19363 if(FirstPair.first > -1)
19366 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19371 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19377 if(SecondPair.first > -1)
19380 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19385 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19391 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
19415 "," + AnsiString(DiagonalLinkNumber));
19420 if(FirstPair.first > -1)
19423 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19428 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19434 if(SecondPair.first > -1)
19437 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19442 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19449 if(FirstPair.first > -1)
19452 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19457 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19463 if(SecondPair.first > -1)
19466 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19471 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19478 if(FirstPair.first > -1)
19481 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19486 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19492 if(SecondPair.first > -1)
19495 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19500 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19507 if(FirstPair.first > -1)
19510 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19515 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19521 if(SecondPair.first > -1)
19524 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19529 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))